﻿@model IEnumerable<OAWeb.Models.Student>

@{
    ViewBag.Title = "Index";
}
@Scripts.Render("~/bundles/jquery")
<script>
    $(function () {
        $('#a').click(function () {
           @{int c = @ViewBag.cid;
               int t = ViewBag.typeid;}
            $('table').append('<tr><td> @Html.TextBox("TeachingClassID", c, new { @class = "text", style = "width: 100px;" })</td> <td> @Html.TextBox("StudentTypeID", t, new { @class = "text", style = "width: 100px;" })</td> <td> @Html.TextBox("Number", "", new { @class = "text", style = "width: 100px;" })</td >  <td>@Html.TextBox("Name", "", new { @class = "text", style = "width: 100px;" })</td> <td>@Html.TextBox("Sex", "", new { @class = "text", style = "width: 100px;" })</td> <td> @Html.TextBox("Nation", "", new { @class = "text", style = "width: 100px;" })</td> <td> @Html.TextBox("Birthday", "",new { @class = "text", style = "width: 100px;" })</td> <td>@Html.TextBox("IDNumber", "",new { @class = "text", style = "width: 150px;" })</td></tr > ');
        })
    })
</script>
<h2>学生信息</h2>

<p>在增加学生时,学生类型通过编号增加（1：正取生  2：备取生  3：往届生）</p>
@using (Html.BeginForm("GetParamsFromFormCollection", "Students"))
{
    <input type="button" id="a" class="n" value="添加" />
    <table class="table">
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.TeachingClass.ClassName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.StudentType.Type)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Number)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Name)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Sex)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Nation)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Birthday)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.IDNumber)
            </th>
            <th></th>
        </tr>

        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.TeachingClass.ClassName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.StudentType.Type)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Number)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Name)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Sex)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Nation)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Birthday)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.IDNumber)
                </td>
                <td>

                    @Html.ActionLink("更改", "Edit", new { id = item.ID }) |
                    @Html.ActionLink("详细信息", "Details", new { id = item.ID }) |
                    @Html.ActionLink("删除", "Delete", new { id = item.ID }, new { onclick = "confirm('你确认删除吗？')" })
                </td>
            </tr>
        }




    </table>
    <input type="submit" value="保存" />

}